package com.dobbyspringside.examples.showcase.demos.redis;

import com.google.common.collect.Maps;

import java.util.Map;

/**
 * Session对象
 * Created by liguoqing on 2016/2/23.
 */
public class Session {

    private String id;

    private Map<String, Object> attributes = Maps.newHashMap();

    public Session() {
    }

    public Session(String id) {
        this.id = id;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Map<String, Object> getAttributes() {
        return attributes;
    }

    public void setAttributes(Map<String, Object> attributes) {
        this.attributes = attributes;
    }

    ///
    public Session addAttribute(String key, Object value) {
        this.attributes.put(key, value);
        return this;
    }

    public Session removeAttribute(String key) {
        this.attributes.remove(key);
        return this;
    }

}
